/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.pucp.sistemasInf.view;

import javax.swing.JDesktopPane;

/**
 *
 * @author alulab11
 */
public class SeleccionMóduloWindow extends javax.swing.JInternalFrame {

    JDesktopPane desktop;
    public SeleccionMóduloWindow(JDesktopPane desktop) {
        initComponents();
        this.desktop=desktop;
        
        btnFactura.setEnabled(false);
        btnReportes.setEnabled(false);
        btnCliente.setEnabled(false);
        btnUsuarios.setEnabled(false);
        
        if (DatosUsuarioSesion.namePerfil.equalsIgnoreCase("Administrador Cuenta")) 
        {
            btnFactura.setEnabled(true);
            btnCliente.setEnabled(true);
        }
        
        if (DatosUsuarioSesion.namePerfil.equalsIgnoreCase("Administrador Sistema"))
        {
            btnUsuarios.setEnabled(true);
        }
        
        if (DatosUsuarioSesion.namePerfil.equalsIgnoreCase("Jefe de Area"))
        {
            btnCliente.setEnabled(true);
            btnReportes.setEnabled(true);
            btnFactura.setEnabled(true);
        }
        
        if (DatosUsuarioSesion.namePerfil.equalsIgnoreCase("Digitador"))
        {
            btnCliente.setEnabled(true);
            btnFactura.setEnabled(true);
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btnCliente = new javax.swing.JButton();
        btnUsuarios = new javax.swing.JButton();
        btnReportes = new javax.swing.JButton();
        btnFactura = new javax.swing.JButton();

        setClosable(true);

        btnCliente.setText("Módulo Cliente");
        btnCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnClienteActionPerformed(evt);
            }
        });

        btnUsuarios.setText("Módulo Usuarios");
        btnUsuarios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUsuariosActionPerformed(evt);
            }
        });

        btnReportes.setText("Módulo Reportes");
        btnReportes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnReportesActionPerformed(evt);
            }
        });

        btnFactura.setText("Módulo Facturas");
        btnFactura.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnFacturaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(34, 34, 34)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(btnCliente, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnReportes, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE))
                .addGap(54, 54, 54)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(btnFactura, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE)
                    .addComponent(btnUsuarios, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(46, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(48, 48, 48)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnFactura, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(45, 45, 45)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnReportes, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnUsuarios, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(65, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClienteActionPerformed
        AgregarClienteJefeWindow agClienteJefe=new AgregarClienteJefeWindow();
        AgregarClienteOperadorWindow agClienteOp=new AgregarClienteOperadorWindow();
            
        if (DatosUsuarioSesion.namePerfil.equalsIgnoreCase("Jefe de Area"))
        {
            desktop.add(agClienteJefe);
            agClienteJefe.setVisible(true);
        }
        
        if (DatosUsuarioSesion.namePerfil.equalsIgnoreCase("Digitador")
            || DatosUsuarioSesion.namePerfil.equalsIgnoreCase("Administrador cuenta"))
        {
            desktop.add(agClienteOp);
            agClienteOp.setVisible(true);
        }
    }//GEN-LAST:event_btnClienteActionPerformed

    private void btnUsuariosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUsuariosActionPerformed
        MóduloUsuariosWindow modUsuarios=new MóduloUsuariosWindow();
        desktop.add(modUsuarios);
        modUsuarios.setVisible(true);
    }//GEN-LAST:event_btnUsuariosActionPerformed

    private void btnFacturaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFacturaActionPerformed
        SelecClienteWindow clw = new SelecClienteWindow();
//        MóduloFacturaWindow modFactura=new MóduloFacturaWindow();
//        desktop.add(modFactura);
  //      modFactura.setVisible(true);
        clw.setVisible(true);
    }//GEN-LAST:event_btnFacturaActionPerformed

    private void btnReportesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnReportesActionPerformed
        // TODO add your handling code here:
        MóduloReporteWindow modReporte=new MóduloReporteWindow();
        desktop.add(modReporte);
        modReporte.setVisible(true);
    }//GEN-LAST:event_btnReportesActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCliente;
    private javax.swing.JButton btnFactura;
    private javax.swing.JButton btnReportes;
    private javax.swing.JButton btnUsuarios;
    // End of variables declaration//GEN-END:variables
}
